﻿<Window x:Class="SEToolbox.Views.WindowSettings"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:commands="clr-namespace:SEToolbox.Services"
        xmlns:controls="clr-namespace:SEToolbox.Controls"
        xmlns:converters="clr-namespace:SEToolbox.Converters"
        ResizeMode="NoResize" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" WindowStyle="ThreeDBorderWindow"
        Title="Settings" Height="180" Width="400" MinWidth="260" MinHeight="200" MaxWidth="800" MaxHeight="800" Icon="/SEToolbox;component/app.ico" Style="{StaticResource DefaultWindowStyle}"
        commands:DialogService.IsRegisteredView="True"
        commands:DialogCloser.DialogResult="{Binding CloseResult}"
        FocusManager.FocusedElement="{Binding ElementName=UxStartBox}">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <converters:BusyMouseConverter x:Key="BusyMouseConverter" />
        <converters:EnumToResouceConverter x:Key="EnumToResouceConverter"/>
    </Window.Resources>
    <Window.Cursor>
        <Binding Path="IsBusy" Converter="{StaticResource BusyMouseConverter}"/>
    </Window.Cursor>
    <Grid>
        <Grid Margin="8">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0" Grid.Column="0" Margin="0,0,0,4">
                <Grid HorizontalAlignment="Stretch" Margin="1,0,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Text="Application Path:" VerticalAlignment="Center" Margin="0,0,4,0"/>
                    <TextBox Grid.Row="0" Grid.Column="1" ToolTip="Space Engineers path.">
                        <TextBox.Text>
                            <Binding Path="SEBinPath" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
                        </TextBox.Text>
                    </TextBox>
                    <Button Grid.Row="0" Grid.Column="2" Content="..." VerticalAlignment="Center" Command="{Binding BrowseAppPathCommand}" Padding="4 0" />
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Custom Voxel Path:" VerticalAlignment="Center" Margin="0,0,4,0"/>
                    <TextBox Grid.Row="1" Grid.Column="1" ToolTip="Specify an additional location for your personal asteroids.">
                        <TextBox.Text>
                            <Binding Path="CustomVoxelPath" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
                        </TextBox.Text>
                    </TextBox>
                    <Button Grid.Row="1" Grid.Column="2" Content="..." VerticalAlignment="Center" Command="{Binding BrowseVoxelPathCommand}" Padding="4 0"/>
                    <TextBlock Grid.Row="2" Grid.Column="0" Text="Check for updates:" VerticalAlignment="Center" Margin="0,0,4,0"/>
                    <CheckBox Grid.Row="2" Grid.Column="1" Content="Always" VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding AlwaysCheckForUpdates}" ToolTip="Check for new updates on startup."/>
                </Grid>
            </Grid>
            
            <Grid Grid.Row="2" Margin="0,8,0,0">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                    <Button Width="90" Command="{Binding OkayCommand}" Content="OK" IsDefault="True" Margin="0,0,8,0" />
                    <Button Width="90" Command="{Binding CancelCommand}" Content="Cancel" IsCancel="True"/>
                </StackPanel>
            </Grid>
        </Grid>
        <controls:BusyIndicator Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}" />
    </Grid>
</Window>
